package com.jdrx.sw.sewage.api.web;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jdrx.platform.commons.rest.beans.vo.ResponseVO;
import com.jdrx.platform.commons.rest.factory.ResponseFactory2;
import com.jdrx.sw.sewage.beans.dto.CdAiLogQueryDTO;
import com.jdrx.sw.sewage.beans.dto.CdParamUpdateDTO;
import com.jdrx.sw.sewage.beans.dto.CdRunCurveDTO;
import com.jdrx.sw.sewage.beans.entity.CdAiLogPO;
import com.jdrx.sw.sewage.beans.entity.CdParamPO;
import com.jdrx.sw.sewage.beans.vo.GatherDevPointOptionVO;
import com.jdrx.sw.sewage.service.ChemicalDosingService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 智能碳源加药demo
 * @author Administrator
 *
 */
@RestController
@RequestMapping(value = "/api/chemicalDosing")
@Api(value = "智能加药")
public class ChemicalDosingApi {
	@Autowired
	private ChemicalDosingService chemicalDosingService;
	
	@ApiOperation(value = "AI对话日志列表")
    @PostMapping(value = "aiLogList")
    public ResponseVO<List<CdAiLogPO>> aiLogList(@RequestBody @Validated CdAiLogQueryDTO dto) {
        return ResponseFactory2.ok(chemicalDosingService.aiLogList(dto));
    }
	
	@ApiOperation(value = "最新实时数据")
    @PostMapping(value = "latestRealtimeData")
    public ResponseVO<Map<String, List<GatherDevPointOptionVO>>> latestRealtimeData() {
        return ResponseFactory2.ok(chemicalDosingService.latestRealtimeData());
    }
	
	@ApiOperation(value = "参数设置")
    @PostMapping(value = "param")
    public ResponseVO<Map<String, CdParamPO>> param() {
        return ResponseFactory2.ok(chemicalDosingService.param());
    }
	
	@ApiOperation(value = "修改参数设置")
    @PostMapping(value = "updateParam")
    public ResponseVO<?> updateParam(@RequestBody @Validated CdParamUpdateDTO dto) {
		chemicalDosingService.updateParam(dto);
        return ResponseFactory2.ok();
    }
	
	@ApiOperation(value = "投加药剂对比")
    @PostMapping(value = "runCurve")
    public ResponseVO<Map<String, Object>> runCurve(@RequestBody @Validated CdRunCurveDTO dto) {
        return ResponseFactory2.ok(chemicalDosingService.runCurve(dto));
    }
	
	@ApiOperation(value = "曝气分析对比")
    @PostMapping(value = "runAerationCurve")
    public ResponseVO<Map<String, Object>> runAerationCurve(@RequestBody @Validated CdRunCurveDTO dto) {
        return ResponseFactory2.ok(chemicalDosingService.runAerationCurve(dto));
    }
}